from peewee import AutoField, CharField, IntegerField, SmallIntegerField
from common.model.abstrct import AbstractModel, IntEnumField
from enums.permission_enum import PermissionStatusEnum


# tenant 租户端所有的侧边栏权限
class TotalSidebarPermission(AbstractModel):

    class Meta:
        table_name = "tb_permission_sidebar"
        auto_increment_base = 10_000_000

    permission_id = AutoField(primary_key=True, help_text="权限id")
    description = CharField(null=True, max_length=255, help_text="权限描述")
    name = CharField(max_length=32, help_text="权限名字")
    alias = CharField(null=True, max_length=32, help_text="权限别名,展示的名字 默认和summary相同")
    path = CharField(max_length=255, help_text="路径", null=True)
    status = IntEnumField(help_text="权限状态,默认是启用", default=PermissionStatusEnum.enable,
                          choices=PermissionStatusEnum)
    parent_id = IntegerField(null=True, help_text="父权限id")
    seq = SmallIntegerField(default=50, help_text="排序值,这个值可以影响到侧边栏按钮的排序")


